#ifndef __BASIC_THREADS_H__
#define __BASIC_THREADS_H__

#include <vector>
#include <thread>

class MultiThread {
  typedef void (*func)();

public:
  bool run();
  void setThreadNum(int num);
  void setFUNC(func pFunc);
  MultiThread() : m_pFunc(nullptr), m_nThreadNum(0){};
  ~MultiThread() {
    delete[] m_pThreads;
  };

private:
  func m_pFunc;
  int m_nThreadNum;
  std::thread* m_pThreads;
};

class DKThreadPool;

class DKThread final {
  M_DELETE_COPY_ASSIGN
public:
  void Joinj();
  void Detach();

private:
  friend class DKThreadPool;
  DKThread();
  ~DKThread();
};

class DKThreadPool final {
  M_DELETE_COPY_ASSIGN
public:
  DKThread* CraeteThread();
  void DestroyThread(DKThread*);
  void JoinAll();
  void DetachAll();

private:
  DKThreadPool() = default;
  ~DKThreadPool() = default;
  std::vector<std::thread> m_vecThread;
};

#endif
